﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class LoginManager : System.Web.UI.Page
{
    AddminMethord AM = new AddminMethord();
    VendorMethord VM = new VendorMethord();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        DataTable dt = VM.Login(txtUserName.Text, txtPassword.Text);
        DataTable da = AM.loginAdmin(txtUserName.Text, txtPassword.Text);
        if(dt.Rows.Count>0){
            Session["VendorName"] = txtUserName.Text;
            Response.Redirect("~/Vendor/VendorHome.aspx");
        }
        else if (da.Rows.Count > 0)
        {

            Session["AdminName"] = txtUserName.Text;
            Response.Redirect("~/Addmin/Home.aspx");
        }
        else {
            lblMsg.Text = "UserName or Password isn't Valid";
        }
            
    }
}